import java.util.Arrays;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 涛
 * Date: 2023-10-12
 * Time: 17:41
 */
public class Test {
    public static void initOrder(int[] array) {
        //逆序数组
        for (int i = 0; i < array.length; i++) {
            array[i] = array.length - i;
        }
    }

    public static void notOrder(int[] array) {
        Random random = new Random();
        for (int i = 0; i < array.length; i++) {
            array[i] = random.nextInt(10_0000);
        }
    }

    public static void testInsert(int[] array) {
        int[] tmpArray = Arrays.copyOf(array,array.length);
        long startTime = System.currentTimeMillis();
        Sort.insertSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("插入排序耗时：" + (endTime - startTime));
    }
    public static void testShell(int[] array) {
        int[] tmpArray = Arrays.copyOf(array, array.length);
        long startTime = System.currentTimeMillis();
        Sort.shellSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("希尔排序耗时：" + (endTime - startTime));
    }

    public static void main(String[] args) {
//        int[] array = new int[10_0000];
//        notOrder(array);
//        testInsert(array);
//        testShell(array);
        int[] array = {100,3,15,61,17,8};
        Sort.selectSort2(array);
        System.out.println(Arrays.toString(array));
    }
}
